package it.uniroma3.dia.training;

import it.uniroma3.dia.models.ErrorRatingMovie;
import it.uniroma3.dia.predictors.AbstractPredictor;
import it.uniroma3.dia.utils.Utils;

import java.util.List;
import java.util.TimerTask;

public class ErrorWatcher extends TimerTask{

	private List<AbstractPredictor> predictors;
	
	public ErrorWatcher(List<AbstractPredictor> predictors) {
		this.predictors = predictors;
	}

	@Override
	public void run() {
		ErrorRatingMovie errorRatingMovie = Utils.calculateErrorMeasure(predictors);
			
		//double totalMAE = errorRatingMovie.getTotalMAE();
		//double totalRMSE = errorRatingMovie.getTotalRMSE();
		int total = errorRatingMovie.getTotal();
		System.out.print(total+" record processed. ");
		System.out.println();
		//System.out.println("MAE = "+(totalMAE/total)+", RMSE = "+Math.sqrt(totalRMSE/total));
	}
}
